﻿
CREATE PROCEDURE [dbo].[proc_Orders_MyOrder]
	(
		@UserName nvarchar(50)
	)
AS
	Select
	 top 20
	 
	Id,
	OId,
	OrderId,
	CustomerId,
	isnull((Select CustomerName From Customer Where CustomerId=Orders.CustomerId),'...') As CustomerName,
	ContactPerson,
	ContactPhone,
	UserName,
	EName,
	FixtureDate,
	Description,
	Aggregateamount,
	isnull(Proceeds,0) as Proceeds,
	CreateDate,
	isnull(CompanyId,'0') As CompanyId,
	isnull(DepartmentId,'0') As DepartmentId,
	FinanceFlag,
	PaymentTypeId,
	IsReason,
	TichengFlag,
	IsNull(TiCheng,0) as TiCheng
	From Orders Where UserName=@UserName Order By Id DESC
	RETURN

